package com.jfs.qy.session;

import com.jfs.qy.entity.response.ChannelInfo;
import org.springframework.http.HttpHeaders;

import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

/**
 * @Description 服务和nvr 回话信息保存类
 * @E-mail cwm3412638@163.com
 * @Author cwm
 * @Date 2022/11/4
 */
public class NvrSessionStorage {
    /**
     * cookie
     */
    public volatile static String strCookie;
    /**
     * X-csrftoken
     */
    public volatile static String strXCsrfToken;

    /**
     * 公共认证信息请求头
     */
    public volatile static HttpHeaders headers;

    /**
     * 查询告警事件readerId
     */
    public volatile static Integer readerId;
    /**
     * 查询告警事件sequence
     */
    public volatile static Integer sequence;
    /**
     * 查询告警事件lapNumber
     */
    public volatile static Integer lapNumber;

    /**
     * 保存所有ipc列表信息
     */
    public static final Map<String, ChannelInfo> CHANNEL_INFO = new ConcurrentHashMap<>();


    /**
     * 获取通道详情
     * @param channelName
     * @return
     */
    public static ChannelInfo getChannel(String channelName) {
        if (CHANNEL_INFO.containsKey(channelName)) {
            return CHANNEL_INFO.get(channelName);
        }
        return null;
    }
}
